﻿#ifndef USERREGISTERCODEC_H
#define USERREGISTERCODEC_H

#include <qobject.h>
#include "ObjAutoInject.h"
#include <qhash.h>

class TcpCodec;
class UserRegisterCodec : public QObject,public ObjAutoInject
{
  Q_OBJECT
public:
  enum RegisterType{
    Unregister=0x00,
    Register,
    Registed,
    Size
  };

private://property
  uchar userNameFlag=0xff;
  uchar passwordFlag=0xfe;
private://dependency
  TcpCodec* tcpCodec=Q_NULLPTR;
public:
  explicit UserRegisterCodec();
  virtual ~UserRegisterCodec();
signals:
  void signal_registerState(uchar state);
public:
  void login(QString userName,QString password);
  void logout();
  void decode(QByteArray data);
public://geter and seter
  TcpCodec* getTcpCodec()const;
  UserRegisterCodec* setTcpCodec(TcpCodec*const tcpCodec);
public:
  virtual void objectAutoInjection(QHash<QString,QObject*>* objMap)override;
};

#endif // USERREGISTERCODEC_H
